import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules,longLimtVal} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {defHttp} from "/@/utils/http/axios";
import {api} from "/@/views/assets/leaseContract/DbHtb.api";
import { InputNumber } from 'ant-design-vue';
import { defineComponent, h } from 'vue';
//列表数据
export const columns: BasicColumn[] = [

   {
    title: '流水号',
    align:"center",
    dataIndex: 'lsh',
   },
   {
    title: '收款日期',
    align:"center",
    dataIndex: 'skqx',
     sorter:true,
   },
   {
    title: '合同编号',
    align:"center",
    dataIndex: 'htbh'
   },
   {
    title: '企业名称',
    align:"center",
    dataIndex: 'qymc',
     sorter:true,
   },
   {
    title: '计收月份',
    align:"center",
    dataIndex: 'sfyf'
   },
   {
    title: '应收金额',
    align:"center",
    dataIndex: 'qkje'
   },
   {
    title: '收款金额',
    align:"center",
    dataIndex: 'skje'
   },
   {
    title: '收款币种',
    align:"center",
    dataIndex: 'skbz'
   },
   {
    title: '当月欠款',
    align:"center",
    dataIndex: 'qkye'
   },
  {
    title: '是否含滞纳金',
    align:"center",
    dataIndex: 'hznj',
    customRender: ({ text }) => {
      return text == 1 ? '是' : text == 0 ? '否' : '';
    },
  },

   {
    title: '发票路径',
    align:"center",
    dataIndex: 'fapiaopath',
    slots: { customRender: 'fapiaopathSlot' },
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'bz'
   },
   {
    title: '操作员',
    align:"center",
    dataIndex: 'czy'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "企业名称",
    field: 'qymc',
    component: 'JInput',
    colProps: {span: 6},
  },
	{
      label: "合同编号",
      field: 'htbh',
      component: 'JInput',
      colProps: {span: 6},
 	},
  {
    label: "计收月份",
    field: 'sfyf',
    colProps: {span: 6},
    component: 'MonthPicker',
    componentProps:{
      showTime:false,
      valueFormat:"YYYY-MM",
      getPopupContainer: () => document.body,
    },
  },
  {
    label:"代扣银行",
    field:"bank",
    component:"JDictSelectTag",
    componentProps:{
      dictCode:"pay_bank"
    },
  },



  {
    label: "收费日期",
    field: "skqx",
    component: 'RangePicker',
    componentProps: {
      valueType: 'Date',
    },
    colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [

  {
    label: '流水号',
    field: 'lsh',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入流水号!', 
          validator: (_, value) => {
            return longLimtVal(value,14)
          },
       },
      ];
    },
  },
  {
    label: '企业名称',
    field: 'qymc',
    component: 'JSearchSelect',
    componentProps:{
     // isRadioSelection:true
      dict:"DB_QYZLB,MC,MC",
      async:true,
      pageSize:10,
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入企业名称!'},
      ];
    },
  },
  {
    label: '合同编号',
    field: 'htbh',
    component: 'Select',
    componentProps:{
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入合同编号!'},
          ];
     },
  },

  {
    label: '计收月份',
    field: 'sfyf',
    component: 'MonthPicker',
    componentProps:{
      showTime:false,
      valueFormat:"YYYY-MM",
      getPopupContainer: () => document.body,
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入计收月份!'},
          ];
     },
    //  slot:"sfyfSlot",
  },
  {
    label: '应收金额',
    field: 'qkje',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入应收金额!'},
      ];
    },
    dynamicDisabled: true,
  },
  {
    label: '收款金额',
    field: 'skje',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入收款金额!'},
      ];
    },
    dynamicDisabled: true,
  },
  {
    label: '收款金额',
    field: 'bigNum',
    component: 'Input',
    show:false,
  },

  {
    label: '收款币种',
    field: 'skbz',
    component: 'JDictSelectTag',
    defaultValue:'人民币',
    componentProps:{
      dictCode:'money_type'
    },
    dynamicDisabled: true,
    show:false,
  },
  {
    label: '当月欠款',
    field: 'qkye',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicDisabled: true,
  },


  {
    label: '收款日期',
    field: 'skqx',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入收款日期!'},
      ];
    },
    slot:"skqxSlot",
  },

  {
    label: '汇率',
    field: 'monRate',
    component: 'InputNumber',
    slot: 'diySlot',
    colSlot: 'diySlot',
    span: 12,
    show: false
  },
  {
    label: '汇总',
    field: 'test',
    component: 'InputNumber',
    slot: 'diySlot',
    colSlot: 'diySlot',
    span: 12
  },
  {
    label: '汇总2',
    field: 'test2',
    component: 'InputNumber',
    slot: 'diy2Slot',
    colSlot: 'diy2Slot',
    span: 12
  },
  {
    label: '工人数',
    field: 'grs',
    component: 'InputNumber',
     componentProps:{
       defaultValue:0
     },
    dynamicDisabled : true,
    show:false
  },
  {
    label: '工人行政费',
    field: 'grgl',
    component: 'InputNumber',
     componentProps:{
       defaultValue:0,
       precision:2
     },
   // slot: 'grglSlot',
    dynamicDisabled:true,
    show:false
    
    
  },
  {
    label: '工人行政计算',
    field: 'c1',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicDisabled: true,
    show:false

  },
  {
    label: '工人行政费币种',
    field: 'pz1',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type',
    },
    defaultValue:'人民币',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '综合管理费',
    field: 'cfgl',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    //slot: 'cfglSlot',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '厂房面积',
    field: 'cfmj',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    //slot: 'cfmjSlot',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '厂房计费计算',
    field: 'c2',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicDisabled: true,
    show:false

  },
  {
    label: '厂房计费币种',
    field: 'pz2',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type'
    },
    defaultValue:'人民币',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '外汇补差',
    field: 'wfbc',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
   // slot: 'wfbcSlot',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '计费标准',
    field: 'jfbz',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
   // slot: 'jfbzSlot',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '外汇补差计算',
    field: 'c3',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicDisabled: true,
    show:false

  },
  {
    label: '外汇补差币种',
    field: 'pz3',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type'
    },
    defaultValue:'人民币',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '厂房租金',
    field: 'cfzj',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    //slot: 'cfzjSlot',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '计费面积',
    field: 'jfmj',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
   // slot: 'jfmjSlot',
    dynamicDisabled:true,
    show:false

  },
  {
    label: '厂房租金计算',
    field: 'c4',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicDisabled: true,
    show:false

  },
  {
    label: '厂房租金币种',
    field: 'pz4',
    component: 'JDictSelectTag',
    defaultValue:'人民币',
    componentProps:{
      dictCode:'money_type'
    },
    dynamicDisabled:true,
    show:false

  },
  {
    label: '土地使用补偿款费用',
    field: 'qtfy',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
   // slot:"qtfySlot"
    dynamicDisabled:true,
    show:false

  },

  {
    label: '土地使用补偿款费用币种',
    field: 'pzQt',
    component: 'JDictSelectTag',
    defaultValue:'人民币',
    componentProps:{
      dictCode:'money_type',
    },
    dynamicDisabled:true,
    show:false

  },
  {
    label: '是否含滞纳金',
    field: 'hznj',
    component: 'JSwitch',
    componentProps:{
      options: ['1', '0'],
    },
    dynamicDisabled: true,
    show:false,
  },
  {
    label: '滞纳金比例(%)',
    field: 'znjbl',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicDisabled: true,
    show:false,

  },
  {
    label: '滞纳金',
    field: 'znj',
    component: 'InputNumber',
    componentProps:{
      defaultValue:0.00,
      precision:2
    },
    dynamicDisabled: true,
    show:false,
  },
  {
    label: '发票文件',
    field: 'fapiaopath',
    component: 'JUpload',
    helpMessage: '最多上传3个文件',
    componentProps: {
      maxCount: 3,
      bizPath: 'fapiao'
    },
  },
  {
    label: '操作员',
    field: 'czy',
    component: 'Input',
    dynamicDisabled: true,

  },

  {
    label: '备注',
    field: 'bz',
    component: 'InputTextArea',
  },


	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
